#include "HelloWorldPubSubTypes.h"
#include "default_participant.h"
#include "default_publisher.h"
//#include "sensor_msgs/msgs/Mocap.h"
#include <chrono>
#include <cstdlib>
#include <future>

int main() {
  // Message
  HelloWorld helloWorld;
  helloWorld.message("hello hi!!!");

  // Create participant. Arguments-> Domain id, QOS name
  DefaultParticipant dp(0, "hii");

  // Create publisher with msg type
  DDSPublisher hello_pub(HelloWorldPubSubType(), "hello",
                            dp.participant());

  // Initialize publisher with topic name
  if (hello_pub.init()) {
    for (int i = 0; i < 1; i++) {
      helloWorld.index(i + 1);
      hello_pub.publish(helloWorld);
      //std::this_thread::sleep_for(std::chrono::milliseconds(1));
    }
  }

  // eprosima::fastdds::dds::DomainParticipantFactory::get_instance()
  //     ->delete_participant(participant_);
}
